package com.wj.auth.controller;

import com.wj.auth.dto.UserDTO;
import com.wj.auth.service.UserService;
import com.wj.auth.vo.UserInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/user")
@RefreshScope
public class UserController {

    @Autowired
    private UserService userService;

    @PostMapping("/register")
    public Boolean postUser(@RequestBody UserDTO userDTO){
        userService.insertUser(userDTO);
        return true;
    }

    @GetMapping("/test")
    public String test01(){
        return "test01";
    }

    @GetMapping("/list")
    public List<UserInfo> getList(){
        List<UserInfo> userList = userService.getUserList();
        return userList;
    }

}